﻿using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Mvc;
using VinhSon.Models;

namespace VinhSon.Areas.Administrator.Controllers
{
    [Authorize]
    public class BaseAdministratorController : Controller
    {
        protected UnitOfWork UnitOfWork = new UnitOfWork();

        public static string ConvertToUnSign(string text)
        {
            for (int i = 32; i < 48; i++)
                text = text.Replace(((char)i) + "", " ");
            text = text.Replace(".", "-");
            text = text.Replace(" ", "-");
            text = text.Replace(",", "-");
            text = text.Replace(";", "-");
            text = text.Replace(":", "-");

            Regex regex = new Regex(@"\p{IsCombiningDiacriticalMarks}+");
            string strFormD = text.Normalize(NormalizationForm.FormD);
            return regex.Replace(strFormD, String.Empty).Replace('\u0111', 'd').Replace('\u0110', 'D');
        }
    }
}
